#ifndef TIMER_H_
#define TIMER_H_

#include <avr/io.h>
#include "irq.h"
#include "types.h"

#define HWND_TIMER0 1
#define HWND_TIMER1 2

enum ClockSelect
{
  CS1024 = 5,
  CS256 = 4,
  CS64 = 3,
  CS8 = 2,
  CSNoPrescaler = 1
}ClockSelect;

typedef struct TIMER
{
  enum ClockSelect CS;
  void (*fHandler)();
}Timer;

extern void startTimer0(const enum ClockSelect CS);
extern void startTimer(Timer *T);
extern void startTimer1(const enum ClockSelect CS);
extern void stopTimer0();
extern void stopTimer1();

extern void onTimer0_Overflow(void (*Handler));
extern void onTimer1_Overflow(void (*Handler));

static DWORD MsToTics(DWORD ms);


#endif /*TIMER_H_*/
